package org.wk.upms.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.wk.upms.dao.RoleDeptDao;
import org.wk.upms.domain.RoleDeptEntity;

import java.util.ArrayList;
import java.util.List;
@Service
public class RoleDeptServiceImpl implements RoleDeptService{
    @Autowired
    private RoleDeptDao roleDeptDao;

    /**
     * 查询角色拥有的数据权限
     *
     * @param roleId
     * @return
     */
    @Override
    public List<String> queryDeptIdList(String roleId) {
        List<RoleDeptEntity> roleDeptEntities = roleDeptDao.findByRoleId(roleId);

        List<String> resData = new ArrayList<>();
        for (RoleDeptEntity entity:roleDeptEntities) {
            resData.add(entity.getDeptId());
        }

        return resData;
    }

}
